<script setup>
import { onMounted, ref } from 'vue'
import { findBannerAPI } from '@/apis/home.js'
const bannerList = ref([])
// 定义请求函数
const getBanner = async () => {
  const res = await findBannerAPI()
  bannerList.value = res.result
  //console.log('Banner图片',res)
}
// 生命周期函数
onMounted(() => getBanner())
</script>

<template>
  <div class="home-banner">
    <el-carousel height="500px">
      <el-carousel-item v-for="item in bannerList" :key="item.id">
        <img :src="item.imgUrl" />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<style lang="scss" scoped>
.home-banner{
  width: 1240px;
  height: 500px;
  position: absolute;
  left: 15px;
  top: 0;
  z-index: 98;
  img{
    width: 100%;
    height: 500px;
  }
  :deep() {
    .el-carousel__arrow--left{
      left: 266px;
    }
  }
}
</style>